
<script src="{{asset(config('view.plugin').'/jquery/jquery-3.2.1.min.js')}}" type="text/javascript"></script>
<script src="{{asset(config('view.plugin').'/bootstrap/4.3/js/popper.min.js')}}"></script>
<script src="{{asset(config('view.plugin').'/bootstrap/4.3/js/bootstrap.min.js')}}" type="text/javascript"></script>
<script src="{{asset(config('view.backend.theme.theme2').'/js/app.js')}}" type="text/javascript"></script>
<script>
    navFocus.focusByUrl('{{route($current_route)}}');
</script>
<!-- END CHAMELEON  JS-->
<script src="{{asset(config('view.plugin').'/layui/layui.js')}}"></script>
<script src="{{asset(config('view.plugin').'/other/day.js')}}"></script>
<script src="{{asset(config('view.backend.theme.theme2').'/js/config.js')}}"></script>
<script src="{{asset(config('view.backend.theme.theme2').'/js/scripts.js')}}"></script>
<script type="text/javascript">
    layui.use(['jquery','layer','appAjax'], function(){
        var $ = layui.jquery;
        var layer = layui.layer;
        var appAjax = layui.appAjax;
        $.ajaxSetup({
            headers: {
                'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
            }
        });
        appAjax.init();
        if ($("#app").is("[data-error]")){
            var msg = $('#app').data('error');
            layer.msg(msg.toString().trim(),{icon:5,shade:0.5});
        }
       getMessage();
        function getMessage() {
            $.get("{{route('b_Message_ajaxGetMessage')}}",function (response) {
                if(response.status ==1){
                    var msgTpl = '<a href="{{route('b_Message_detail',['id'=>-15284])}}" class="list-group-item notice-list-item py-1 bd-bottom">' +
                        '  <p class="notice-title mb-2">{%content%}</p>' +
                        '   <p class="notice-time">{%time%}</p>' +
                        '</a>';
                    var msgHtml = ''
                    var data = response.data;

                    var length = data.length;
                    if(length>0){
                        $("#no-read-msg").text(length);
                        for (var index in data){
                            msgHtml += msgTpl.replace('{%content%}',data[index]['content']).replace('-15284',data[index]['id'])
                                .replace('{%time%}',dayjs.unix(data[index]['created_at']).format("YYYY-MM-DD HH:mm"));
                        }
                        msgHtml +='<a href="{{route('b_Message_index')}}" class="list-group-item text-center"><span>查看更多</span></a>';
                        $("#msg-list").after(msgHtml);
                    }
                }
            });
        }
    });

    function showImg(imgSrc) {
        layer.open({
            type:1,
            title:false,
            content:'<div style="margin: 10px;"><img style="width:100%;height: 100%;" src="'+imgSrc+'"/></div>'
        });
    }

</script>
@stack('scripts')
